package com.library.admin.listener;

import com.library.admin.AdmLibrary;
import com.library.admin.form.UpdateExemplariesNumberForm;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Window;

public class ShowExemplariesNumberListener implements ClickListener {
	private static final long serialVersionUID = -7415103035291512537L;

	private String bookIsbn;
	
	public ShowExemplariesNumberListener(String bookIsbn) {
		this.bookIsbn = bookIsbn;
	}

	public void buttonClick(ClickEvent event) {
		AdmLibrary libraryApplication = (AdmLibrary) event.getComponent()
				.getApplication();
		Window updateExemplariesFormWindow = new Window("Exemplaires");
		updateExemplariesFormWindow.setWidth("30%");
		updateExemplariesFormWindow.setModal(true);
		updateExemplariesFormWindow.setResizable(false);
		updateExemplariesFormWindow.center();
		updateExemplariesFormWindow
				.addComponent(new UpdateExemplariesNumberForm(bookIsbn));

		libraryApplication.getMainWindow().addWindow(
				updateExemplariesFormWindow);
	}
}
